jQuery(document).ready(function() {
    var $pagination = jQuery('.pager');
    var $container = jQuery('<div>');
    $pagination.find('*').each(function() {
        var $a = jQuery(this);
        var $li = jQuery('<li>').css('margin', '0 2px');
        var $clone = $a.clone();

        var digit = $a.text();
        switch (digit) {
            case '<':
                $li.addClass('pager-first');
                $clone.text('‹ Anterior');
                break;
            case '>':
                $li.addClass('pager-next');
                $clone.text('Próximo ›');
                break;
            case '‹ First':
                $li.addClass('pager-first');
                $clone.text('‹‹ Primeiro');
                break;
            case 'Last ›':
                $li.addClass('pager-last');
                $clone.text('Último ››');
                break;
            default:
                if ($clone.is('strong')) {
                    $li.addClass('pager-current');
                }
                $li.addClass('pager-item');
                break;
        }
        $li.append($clone);
        $container.append($li);
    });
    $pagination.html($container.html());
});